package thread06;

/**
 * JDK 21创建线程(侧重链式编程)
 *  public static Builder.OfPlatform ofPlatform():获取一个线程构造工厂
 *  Thread start(Runnable task):既可以指定线程运行任务又可以运行线程
 *  OfPlatform name(String name):为线程命名
 */
public class ThreadDemo01 {
    public static void main(String[] args) {
   /*     Thread.ofPlatform().start(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName() + "..." + i);
                }
            }
        });*/

        Thread.ofPlatform().name("小白").start(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName() + "..." + i);
                }
            }
        });

        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + "..." + i);
        }
    }
}
